<?php

declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://doc.hyperf.io
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
 */

namespace App\Controller\Api;
use Hyperf\DbConnection\Db;
use Hyperf\HttpServer\Request;
use Hyperf\View\RenderInterface;
use SmsDemo;
class IndexController
{
	

	
	
    public function index(Request $request)
    {
        $user = $request->input('user', 'Hyperf');
        $method = $request->getMethod();

       // $this->sendSms('16626705724','23423424');
	   //$sms = SmsDemo::sendSms('16626705724','23423424');
	   //var_dump($sms);
       // 通过 DI 容器获取或直接注入当前类
       $redis = getObject('Redis');
       $redis->set('key1','123123112312');
       $res = $redis->get('key1');
       var_dump($_SERVER['SSH_CLIENT']);
       return json_encode([
            'method' => $method,
            'message' => "Hello {$user}.",
        ]);
    }

    public function view(RenderInterface $render){
        $redis = getObject('Redis');

        $res = $redis->get('key1');
        var_dump($res);
      //  return $render->render('index', ['name' => 'Hyperf']);
    }
    
    

}
